#include <iostream>

using namespace std;

static bool prime(int n) {
    if (n < 2)
        return false;
    if (n == 2)
        return true;
    if (n % 2 == 0)
        return false;
    for (int i = 3; i * i <= n; i += 2)
        if (n % i == 0)
            return false;
    return true;
}

int main() {
    int r = 0;
    for (int i = 1; ; ++i) {
        int p = 3 * i * i + 3 * i + 1;
        if (p > 100'0000)
            break;
        if (prime(p))
            ++r;
    }
    cout << r << endl;
}